//
//  BaseCoordinator.swift
//  SwiftUi
//
//  Created by xm on 05/09/2025.
//

import Foundation

import SwiftUI

@MainActor
protocol AnimesCoordinatorProtocol {
    func showDetail(for anime: Anime)
    
}


@MainActor
@Observable
final class AnimesCoordinator: AnimesCoordinatorProtocol {
    var routes: [Route] = []
        
    init() {
        self.routes = routes
    }
    
    func showDetail(for anime: Anime) {
        let viewModel = AnimeViewModel(anime: anime, coordinator: self)
        let route = RouteIdentifier(value: viewModel, id: \.anime.id)
        routes.append(.animeDetail(route))
    }
        
    enum Route :Hashable{
        

        
        case animeDetail(RouteIdentifier<AnimeViewModel>)
    }
}



